{% import "macro.html.twig" as web_macro %}

<table class="table table-striped table-hover" id="order-table">
  <thead>
  <tr>
    <th width="30%">{{ 'merchant.content_resource.product_title'|trans }}</th>
    <th width="30%">{{ 'merchant.content_resource.product_change_log_publish'|trans }}</th>
    <th>{{ 'merchant.content_resource.product_change_publish_time'|trans }} </th>
    <th>{{ 'merchant.content_resource.product_version_num'|trans }}</th>
    <th width='120'>{{'merchant.content_resource.operation'|trans}}</th>
  </tr>
  </thead>
  <tbody class="js-table-container">
  {% if productVersionList|default() != '' %}
    {% for index,productVersion in productVersionList|default() %}

      {% set productCourseSet = productVersion.courseSet|default() %}
      <tr id="product-version-table" style="word-break: break-all;word-wrap: break-word;">
        <td>
          <img src="{{ filepath(course_set_cover(productCourseSet, 'small'), 'courseSet.png') }}" class="img-responsive" style="float: left;margin-right: 10px;width: 45%;">
          <span title="《{{ productCourseSet.title }}》">{{ 'course'|trans }}《{{ productCourseSet.title|sub_text(25) }}》</span>
        </td>
        <td>
          {% for changeLog in productVersion.changelog %}
          <div class="middle-info pull-left short-long-text width-full">
            <div class="short-text text-muted">
              《{{ changeLog.title | default('') }}》: {{ changeLog.versionChangeLog | default('') |plain_text(80) }}
              <span class="trigger">({{ 'admin.app_center.description_open'|trans }})</span>
            </div>
            <div class="long-text text-muted" style="color:black;">
              《{{ changeLog.title | default('') }}》: {{ changeLog.versionChangeLog | default('') |raw }}
              <span class="trigger">({{ 'admin.app_center.description_close'|trans }})</span>
            </div>
          </div>
          {% endfor %}
        </td>
        <td>{{ productVersion.updatedTime|date('Y-m-d') }}</td>
        <td>
          {% for changeLog in productVersion.changelog %}

            <a href="javascript:" class="width-full"  {% if changeLog.version |default(0) > 1 %} data-toggle="modal" data-target="#modal" data-url="{{ path('admin_v2_content_resource_product_version_detail', {remoteSourceId: changeLog.courseId | default(0)}) }}" {% endif %}>
              《{{ changeLog.title | default('') }}》:
              {{ 'merchant.content_resource.product_version'|trans }}
              {{ changeLog.version | default('') }}
              <br />
            </a>
          {% endfor %}
        </td>
        <td>
            {% if productCourseSet != '' %}
              <a target="_blank" href="{{ path('course_set_manage_base', {id: productCourseSet.id}) }}">{{'merchant.content_resource.product_version.view_btn'|trans}}</a>
            {% endif %}
              <a href="javascript:" class="" data-toggle="modal" data-target="#modal" data-url="{{ path('admin_v2_content_resource_update_product_version', {productId: productVersion.id|default(0)}) }}">{{ 'merchant.content_resource.product_version.update_btn'|trans  }}</a>
        </td>
      </tr>
    {% endfor %}
  {% else %}
    <tr><td colspan="20"><div class="empty">{{'site.datagrid.empty'|trans}}</div></td></tr>
  {% endif %}
  </tbody>
</table>
<div class="paginator">
{#  {{ admin_macro.paginator(paginator) }}#}
</div>
